{% extends "mall/base.html" %}

{% block title %}
    {{ title }}
{% endblock %}

{% block css %}
    <style>
        body {
            background: rgb(245, 245, 245);
        }

        .address {
            width: 100%;
            color: rgb(13, 13, 13);
            background-color: white;
            margin: 0 0 20px 0;
            display: inline-block;
        }

        .name {
            width: 50%;
            float: left;
            text-align: left;
        }

        .phone {
            width: 50%;
            float: right;
            text-align: right;
        }
    </style>
{% endblock %}

{% block header %}
{% endblock %}

{% block content %}
    <div class="container">
        <input type="hidden" name="is_wechat" value="{{ is_wechat }}">
        <input type="hidden" name="open_id" value="{{ open_id }}">
        <div>
            {% for foo in address_list %}
                <div class="address address-item" data-id="{{ foo.address_id }}">
                    <div style="width: 92%;margin:0 auto;">
                        <div>
                            <div class="name">{{ foo.name }}</div>
                            <div class="phone">{{ foo.phone }}</div>
                        </div>
                        <br>
                        <div style="text-align: center;clear: both;margin:10px 0;color:rgb(26,26,26);">
                            {{ foo.province }} {{ foo.city }} {{ foo.county }} {{ foo.detail_address }}
                        </div>
                        <div style="color: rgb(122,122,122);">
                            <div style="width: 50%;float: left;text-align: left;    height: 50px;line-height: 60px">
                                {% if foo.is_default %}
                                    <label style="color:rgb(247,70,70)">默认地址</label>
                                {% else %}
                                    <label>设为默认</label>
                                {% endif %}
                            </div>
                            <div style="width: 50%;float: right;text-align: right">
                                <input type="button" class="weui-btn weui-btn_mini weui-btn_default edit"
                                       data-id="{{ foo.address_id }}" value="编辑">
                                <input type="button" class="weui-btn weui-btn_mini weui-btn_default delete"
                                       data-id="{{ foo.address_id }}" value="删除">
                            </div>
                        </div>
                    </div>
                </div>
            {% endfor %}

        </div>
        <br>
        <div>
            <a href="javascript:" class="weui-btn" id="add" style="color:white;background: rgb(247,70,70);">添加新地址</a>
        </div>
        <br>
        <div>
            <a href="javascript:void(0);" class="weui-btn weui-btn_plain-default" id="back">返回</a>
        </div>
    </div>
{% endblock %}

{% block footer %}
{% endblock %}

{% block js %}
    <script src="{{ STATIC_URL }}/static/js/mall/address_manage.js?v={{ version_code }}"></script>
{% endblock %}